Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sui)!: add script option to pause sui contracts #519

Open
wants to merge 40 commits into
base: feat/update-its-naming
Choose a base branch
from

Conversation

Foivos
Copy link
Contributor

@Foivos Foivos commented Jan 28, 2025

No description provided.

@Foivos Foivos requested a review from a team as a code owner January 28, 2025 12:16
@Foivos Foivos changed the base branch from main to feat/update-its-naming January 28, 2025 12:19
evm/interchainTokenFactory.js Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
sui/its.js Outdated Show resolved Hide resolved

// Do not dissalow `allow_function` because that locks the gateway forever.
if (Number(version) === allowedFunctionsArray.length - 1) {
const index = allowedFunctions.indexOf('allow_function');
Copy link
Member

Choose a reason for hiding this comment

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

we also don't want to disallow disallow_function as well

@@ -510,6 +509,65 @@ async function testNewField(value, options) {
console.log(`Set the value to ${value} and it was set to ${returnedValue}.`);
}

async function pause(keypair, client, config, chain, contracts, args, options) {
Copy link
Member

Choose a reason for hiding this comment

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

I think we should support a few approaches based on the use-cases:

  • pause: Allow pausing a curated list of critical entrypoints. In an emergency, we want to pause critical entrypoints but not necessary all (e.g. functions that allow changing configuration like trusted chains / flow limit should be kept available for operations).
  • pause --all: Allow pausing all exposed methods except allow/disallow function
  • disableVersion: Allow disabling all methods of a given version, including allow/disallow function, but ensure that this can be only run for older versions. This allows us to disable the previous version after an upgrade dynamically. The upgrade after this one will also enforce this in the source code later.

Copy link
Member

Choose a reason for hiding this comment

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

For both gateway, and ITS, let's hardcode a curated list of entrypoints that should be paused. For gateway, perhaps approve_messages and rotate_signers that can be affected by proof validation issues

sui/gateway.js Show resolved Hide resolved
.action((options) => {
mainProcessor(unpause, [], options);
});

Copy link
Member

Choose a reason for hiding this comment

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

update test-sui.yaml to run pause/unpause for gateway and ITS. Want to ensure that this action always work, instead of finding issues during an emergency

versions: versionsArg,
disallowedFunctions: allowedFunctionsArg,
},
`${__dirname}/../axelar-chains-config/info/sui-gateway-allowed-functions-${options.env}.json`,
Copy link
Member

Choose a reason for hiding this comment

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

save to the existing sui.contracts.AxelarGateway config which is already included in git

Copy link
Member

Choose a reason for hiding this comment

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

Instead of dynamically querying this, we should look into creating a json file in the cgp sui that lists the version controlled methods, and including it in the npm release. We already do something like this for the golden test, so shouldn't be hard to add a JSON file containing contract name -> allowed function list mapping

Comment on lines +238 to +245
const allowFunctionsProgram = new Command()
.name('allow-functions')
.description('Allow functions')
.command('allow-functions <versions> <functions>')
.action((versions, functions, options) => {
mainProcessor(allowFunctions, options, [versions, functions], processCommand);
});

Copy link
Member

Choose a reason for hiding this comment

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

create a separate contract.js script that allows generically allowing/disallowing function by version for any of our contract. It can do also support pause --all, unpause --all. And for the curated pause and unpause we can create an object mapping for contract name -> curated function list

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.

2 participants