Skip to content

Conversation

rabi-siddique
Copy link

@rabi-siddique rabi-siddique commented Jul 25, 2025

closes:

refs:

The PR does the following:

  • Removed unused chainName Factory
  • Enforced Agoric-only source chain validation with keccak256 constant
  • Introduced usedNonces mapping to prevent replay attacks
  • Renamed emitted event to NewWalletCreated with clarified fields. This event now also emit nonce value
  • Updated Factory to no longer send response payload or handle gas payment
  • Wallet contract kept as-is with internal multicall and event emission
  • Updated existing tests and added new tests for nonce and source chain validation.

@rabi-siddique rabi-siddique force-pushed the rs-parse-and-emit-evm-info branch from 5e323c5 to 164e0ca Compare July 25, 2025 06:27
@rabi-siddique rabi-siddique requested review from dckc and michaelfig July 25, 2025 11:26
@rabi-siddique rabi-siddique self-assigned this Jul 25, 2025
Copy link

@dckc dckc left a comment

Choose a reason for hiding this comment

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

I hope someone else can get to this sooner than I can.

I usually start by looking at tests. I could use help finding them. In particular, I could use help finding ci logs of tests for the new feature.

@rabi-siddique
Copy link
Author

I hope someone else can get to this sooner than I can.

I usually start by looking at tests. I could use help finding them. In particular, I could use help finding ci logs of tests for the new feature.

  • Unit tests are in
    packages/axelar-local-dev-cosmos/src/__tests__/Factory.spec.ts.

  • Integration tests are triggered by
    .github/workflows/agoric-integration.yml.
    I suggest reviewing this workflow to understand how the chains are set up for Agoric-to-EVM transactions.

  • As for logs, here's a direct link to the recent run:
    CI logs
    Look at the “Relay data from EVM” step. It contains the logs for the new changes I added.

@rabi-siddique rabi-siddique requested a review from frazarshad July 25, 2025 15:55
mergify bot added a commit to Agoric/agoric-sdk that referenced this pull request Jul 25, 2025
refs: #11647 

## Description

This PR does the following:
- Maintain a `nonce` value axelar gmp account kit.
- Add a method to retrieve and increment the current nonce. 
- Remove the previous logic of passing `gasAmount` via `offerArgs`
- Update related tests accordingly.

These changes are used primarily in the [`agoric-labs/agoric-to-axelar-local`](https://github.com/agoric-labs/agoric-to-axelar-local) repo, specifically supporting [PR #20](agoric-labs/agoric-to-axelar-local#20). The goal is to ensure smooth local development and verify cross-chain integration behavior.

### Security Considerations

No new security-relevant assumptions are introduced by this change.

### Scaling Considerations

Not applicable. This is an example contract intended for local development and testing, not production deployment.

### Documentation Considerations

No documentation updates are necessary.

### Testing Considerations

Current suite of tests are enough to verify the changes made.

### Upgrade Considerations

Not applicable, as this is for local testing only.
Copy link

@dckc dckc left a comment

Choose a reason for hiding this comment

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

browsing/skimming prompted various questions

To get up to speed to approve something like this, I would need quite a bit of help and/or study time.

).to.be.revertedWith("nonce already used by sender");
});

it("should revert if message comes from a chain besides agoric", async () => {
Copy link

Choose a reason for hiding this comment

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

To what extent does this prevent forgery? Do we know that when it comes from Agoric, it's coming from an orchestration-controlled account? Or can anybody with a normal key-based account send such a message?

Copy link

Choose a reason for hiding this comment

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

I suppose if anyone wants to pay for such an account, we don't mind.

Comment on lines +154 to +155
.to.emit(factory, "NewWalletCreated")
.withArgs(expectedWalletAddress, nonce, sourceAddress, "agoric");
Copy link

Choose a reason for hiding this comment

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

this looks like the gist of it

👍

}

contract Factory is AxelarExecutable {
using StringToAddress for string;
Copy link

Choose a reason for hiding this comment

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

the production contract is in a __tests__ directory?

Comment on lines +93 to +94
// TODO: Should we consider limiting or cleaning this mapping to avoid unbounded growth?
mapping(string => mapping(uint256 => bool)) public usedNonces;
Copy link

Choose a reason for hiding this comment

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

Do we need to track used nonces separately for each source address?
How about just 1 lastNonceUsed for the whole Factory contract?
The ymax contract can issue nonces that are unique across all portfolios (zone.mapStore('evmNonce') with just 1 key such as it or theNonce).

If somebody wants to track a different sequence of nonces they can deploy a new instance of this Factory contract, I suppose.

Copy link

Choose a reason for hiding this comment

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

now I see why we need to track nonces separately for each account - we may have >1 accounts pending at some point in time.

But we don't need a full bitmap; just a strictly increasing "highest nonce used so far".

const SDK_REPO = "https://github.com/Agoric/agoric-sdk.git";
const SDK_DIR = "/usr/src/agoric-sdk-cp";
const BRANCH_NAME = "master";
const BRANCH_NAME = "rs-use-nonce-in-axelar-gmp-contract";
Copy link

Choose a reason for hiding this comment

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

is this PR supposed to land with this change?

Copy link
Collaborator

Choose a reason for hiding this comment

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

relay.ts is meant to be a super generalized script. please create a new one instead for similar to relayWithTokens.ts etc

using AddressToString for address;

address _gateway;
address gatewayAddr;
Copy link
Collaborator

Choose a reason for hiding this comment

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

the _ indicates that it is a private variable. would be good to add that to the new name as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants