Skip to content

Conversation

@dckc
Copy link
Member

@dckc dckc commented Nov 5, 2025

refs:

Description

Refuse to ask CCTP relayers to handle amounts below their threshold.

Security Considerations

Relies on the premise that funds in @noble are under the portfolio owner's control; i.e. they can withdraw them... which see https://github.com/Agoric/agoric-private/issues/492

Scaling Considerations

n/a

Documentation Considerations

Primary documentation is in the UI. The diagnostic here is Just In Case.

Testing Considerations

existing tests needed updating

Upgrade Considerations

behavior only. no exo state changes. compatible with ymaxControl.upgrade(...).

@dckc dckc self-assigned this Nov 5, 2025
Copy link
Contributor

@frazarshad frazarshad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC. this limit also exists for CCTP from evm -> cosmos. should we also add a check there?

@dckc
Copy link
Member Author

dckc commented Nov 5, 2025

IIRC. this limit also exists for CCTP from evm -> cosmos.

No; latest from Noble (Oct 29) is "for inbound transfers to Noble that minimum should not apply."

@dckc dckc changed the title fix(portfolio-contract): limit outbound CCTP to >= 1USDC fix(portfolio-contract)!: limit outbound CCTP to >= 1USDC Nov 5, 2025
const { chainId, remoteAddress } = dest;
traceTransfer('transfer', denomAmount, 'to', remoteAddress);
amount.value >= CCTP_OUTBOUND_THRESHOLD ||
Fail`too small to relay: ${amount} below ${CCTP_OUTBOUND_THRESHOLD}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be amount.value?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason?

Oh... I guess it should be q(amount)

*
* XXX could be configurable for test networks
*/
const CCTP_OUTBOUND_THRESHOLD = 1_000_000n;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add a test for threshold enforcement.
A test that uses values less than 1 USDC.


test('claim rewards on Aave position', async t => {
const amount = AmountMath.make(USDC, 300n);
const amount = AmountMath.make(USDC, 2_000_000n);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider using withAmountUtils in this test to make it easier to work with units. this could be

Suggested change
const amount = AmountMath.make(USDC, 2_000_000n);
const amount = usdc.units(2.0);

Even better you could inline the amount since the name isn't helping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants