Skip to content

Add Gringotts scenario test scripts#29

Open
codchen wants to merge 2 commits into
tony/solidityfrom
codex/gringotts-scenario-tests
Open

Add Gringotts scenario test scripts#29
codchen wants to merge 2 commits into
tony/solidityfrom
codex/gringotts-scenario-tests

Conversation

@codchen
Copy link
Copy Markdown
Collaborator

@codchen codchen commented May 19, 2026

Describe your changes and provide context

Testing performed to validate your change

@cursor
Copy link
Copy Markdown

cursor Bot commented May 19, 2026

PR Summary

Medium Risk
Includes a production Solidity behavior change that prevents removing the last operator, which can affect governance/admin flows on deployed contracts. The rest is test/deployment tooling, but the new scripts can execute live transactions when EXECUTE=true is set.

Overview
Adds a new scripts/scenario-tests/ suite (with guarded static/review mode by default) to exercise a deployed Gringotts proxy for access control, vesting withdrawals, staking operations, reward withdrawals, governance proposal lifecycles, and upgrade flows.

Introduces GringottsV2Dummy and extends the Hardhat unit tests to validate upgrading the proxy via admin proposals and calling new functions post-upgrade.

Updates the core contract to revert on removing the last operator (CannotRemoveLastOperator) and refreshes example deploy/config JSON plus committed testnet deployment artifacts.

Reviewed by Cursor Bugbot for commit b85586e. Bugbot is set up for automated code reviews on this repo. Configure here.

"unlockDistributionAddress": "0x7fd42b44F08eC90Aa7C82f9C40235Dc66b86C201",
"stakingRewardAddress": "0x6199d949c97e818abd967EC9EcA3e89FFbE92C44",
"maxVotingPeriod": 300,
"adminVotingThresholdPercentage": 50,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Example config replaced with real testnet-specific values

Medium Severity

The deploy-and-create.example.json template file had its obvious placeholder addresses (0x1111..., 0x2222..., etc.) replaced with real testnet addresses, maxVotingPeriod lowered from 3600 to 300, and adminVotingThresholdPercentage lowered from 75 to 50. The deploy script (deploy-and-create.js) references this file by name as its example config. Replacing self-documenting placeholders with real values means someone following the usage instructions could accidentally deploy against these specific addresses and with reduced governance security parameters.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2ecf9f1. Configure here.

Compile contracts first so the scripts can load current ABIs, including `GringottsV2Dummy`:

```bash
cd /Users/xiaoyuchen/repos/gringotts/solidity
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

README contains hardcoded local filesystem paths

Low Severity

The README contains developer-local absolute paths (/Users/xiaoyuchen/Downloads/EVM Gringotts Testing.txt on line 3 and /Users/xiaoyuchen/repos/gringotts/solidity on line 12) that are meaningless and broken for any other developer cloning the repo. These look like they were left in from local development.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2ecf9f1. Configure here.

"totalAmount": "3000000000000000000",
"vestingTotal": "3000000000000000000"
}
} No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Testnet deployment artifact committed with local path

Low Severity

A specific testnet deployment output file was committed to the repo. It contains a local filesystem path in configFile (/Users/xiaoyuchen/repos/...), deployer addresses, and transaction hashes from a one-off testnet deployment. The deployments/ directory is not in .gitignore, and loadScenarioConfig() in common.js auto-discovers the latest file from this directory, meaning this committed artifact will silently become the default proxy address for anyone running the scenario scripts.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2ecf9f1. Configure here.

runner,
contract,
actors.admin,
actors.secondAdmin || actors.nonAdmin,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Non-admin fallback voter breaks expiration test logic

Medium Severity

The fallback actors.secondAdmin || actors.nonAdmin passes a non-admin wallet as the voter to expectVoteAfterExpirationBehavior. The voteProposal contract method requires admin permission, so when secondAdmin is unavailable the transaction reverts due to access control — not due to expiration. The test then reports a misleading failure for the wrong reason. The equivalent scenario in access-tests.js correctly guards with requireActor(runner, actors.secondAdmin, "secondAdmin") and returns early if missing.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2ecf9f1. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 5 total unresolved issues (including 4 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b85586e. Configure here.

.sort((a, b) => fs.statSync(b).mtimeMs - fs.statSync(a).mtimeMs);

if (files.length === 0) return {};
return JSON.parse(fs.readFileSync(files[0], "utf8"));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Wrong deployment file chosen

Medium Severity

latestDeployment picks the newest file by filesystem mtime, not the embedded deploy timestamp in gringotts-*-<ms>.json. After clone or when mtimes tie, sort order is unstable, so scenario scripts may target the wrong proxy and params.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b85586e. Configure here.

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.

1 participant