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

Add Governance action event support #19252

Merged
merged 14 commits into from
Sep 27, 2024
Merged

Add Governance action event support #19252

merged 14 commits into from
Sep 27, 2024

Conversation

Bridgerz
Copy link
Contributor

@Bridgerz Bridgerz commented Sep 6, 2024

Description

Governance action support

Test plan

Spot check on my local machine. Indexer validity checker tool coming soon...

Copy link

vercel bot commented Sep 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 27, 2024 7:04pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Sep 27, 2024 7:04pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Sep 27, 2024 7:04pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Sep 27, 2024 7:04pm

crates/sui-bridge-indexer/src/eth_bridge_indexer.rs Outdated Show resolved Hide resolved
crates/sui-bridge-indexer/src/lib.rs Outdated Show resolved Hide resolved
crates/sui-bridge-indexer/src/lib.rs Outdated Show resolved Hide resolved
crates/sui-bridge-indexer/src/schema.rs Show resolved Hide resolved
crates/sui-bridge-indexer/src/eth_bridge_indexer.rs Outdated Show resolved Hide resolved
crates/sui-bridge-indexer/src/eth_bridge_indexer.rs Outdated Show resolved Hide resolved
crates/sui-bridge-indexer/src/eth_bridge_indexer.rs Outdated Show resolved Hide resolved
crates/sui-bridge-indexer/src/eth_bridge_indexer.rs Outdated Show resolved Hide resolved
@@ -142,6 +142,56 @@ fn process_sui_event(
data: None,
}))
}
"UpdateRouteLimitEvent" => {
Copy link
Contributor

Choose a reason for hiding this comment

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

strum::IntoStaticStr

crates/sui-bridge-indexer/src/storage.rs Show resolved Hide resolved
crates/sui-bridge-indexer/src/eth_bridge_indexer.rs Outdated Show resolved Hide resolved
}
EthSuiBridgeEvents::InitializedFilter(_) => {}
Copy link
Contributor

Choose a reason for hiding this comment

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

we need to capture these, and set alerts (they shouldn't happen though)

crates/sui-bridge-indexer/src/lib.rs Show resolved Hide resolved
}
EthBridgeConfigEvents::InitializedFilter(_) => {}
},
EthBridgeEvent::EthCommitteeUpgradeableContractEvents(_) => {}
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't care about this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no we're capturing a different upgrade event

Copy link
Contributor

Choose a reason for hiding this comment

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

what happens when this event gets emitted? should we scream?

Copy link
Contributor

Choose a reason for hiding this comment

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

I have added warn log for all the unexpected events.

@@ -1,6 +1,8 @@
CREATE TABLE governance_actions
(
id BIGSERIAL PRIMARY KEY,
nonce BIGINT,
data_source TEXT NOT NULL,
Copy link
Contributor

Choose a reason for hiding this comment

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

we should use chain_id v.s. data_source for convention

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was following how we are currently doing it for the "token transfer" table.

Copy link
Contributor

Choose a reason for hiding this comment

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

chain id and datasource is 2 different thing, chain id is part of the key of the bridge message and the datasource in token transfer table is referring to the source of the data.

Copy link
Contributor

Choose a reason for hiding this comment

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

in this case I think chain id is more appropriate, we might also want to include the message type as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

do you plan to want this to chain_id in this PR ? @patrickkuo

Copy link
Contributor

Choose a reason for hiding this comment

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

we will need to include the chain id in the event to be able to record it, which require more changes, will need to leave it post launch

txn_digest bytea NOT NULL,
sender_address bytea NOT NULL,
timestamp_ms BIGINT NOT NULL,
action text NOT NULL,
Copy link
Contributor

Choose a reason for hiding this comment

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

same, avoid using string, there is BridgeActionType https://github.com/MystenLabs/sui/blob/main/crates/sui-bridge/src/types.rs#L197

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you suggesting we update the db schema to include a "BridgeActionType" enum? We aren't doing this with any of our other enums (for instance status and data_source are also saved as Text), but not a bad idea...

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah that's the suggestion. I think we should rework all of them to integer post launch

@@ -1,6 +1,8 @@
CREATE TABLE governance_actions
(
id BIGSERIAL PRIMARY KEY,
nonce BIGINT,
data_source TEXT NOT NULL,
Copy link
Contributor

Choose a reason for hiding this comment

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

do you plan to want this to chain_id in this PR ? @patrickkuo

@patrickkuo patrickkuo merged commit 1f2ac8e into main Sep 27, 2024
47 of 48 checks passed
@patrickkuo patrickkuo deleted the bridge-indexer-governance branch September 27, 2024 19:58
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.

3 participants