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

fix(sequencer)!: store native asset ibc->trace mapping in init_chain #1242

Merged
merged 3 commits into from
Jul 8, 2024

Conversation

noot
Copy link
Collaborator

@noot noot commented Jul 6, 2024

Summary

we need to store the native asset ibc to "trace" mapping in the state, otherwise queries for the native asset using the ID will fail. for example get_bridge_account_info where the asset is the native asset fails right now

Changes

  • store native asset ibc->trace mapping in init_chain
  • also enforce that the native asset is is "trace" form, as otherwise, we won't be able to map from ibc->trace form for the asset as we don't know the trace form.

Breaking changes

  • this is unfortunately breaking since the ibc->trace mapping is stored in app state.

@noot noot requested a review from a team as a code owner July 6, 2024 17:11
@noot noot requested a review from SuperFluffy July 6, 2024 17:11
@github-actions github-actions bot added the sequencer pertaining to the astria-sequencer crate label Jul 6, 2024
@noot noot requested a review from joroshiba as a code owner July 6, 2024 17:44
Comment on lines +225 to +232
let native_asset = crate::asset::get_native_asset();
if let Some(trace_native_asset) = native_asset.as_trace_prefixed() {
state_tx
.put_ibc_asset(trace_native_asset)
.context("failed to put native asset")?;
} else {
bail!("native asset must not be in ibc/<ID> form")
}
Copy link
Member

Choose a reason for hiding this comment

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

what's going on with indent here? it feels like there is a missing block here?

Copy link
Member

Choose a reason for hiding this comment

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

The indent is actually fine - github code wrapping makes this look a bit weird if your window is too narrow.

Copy link
Member

Choose a reason for hiding this comment

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

Oh wow that was cursed. dammit github

Copy link
Member

@SuperFluffy SuperFluffy left a comment

Choose a reason for hiding this comment

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

That was my oversight, thank you for fixing it.

I actually want to get rid of these globals (meaning the native asset one here and the base address prefix), and instead have a new StateExt where these are read everytime they are needed.

I believe this should have a negligible impact on performance, makes testing easier, and would avoid errors such this one.

Comment on lines +225 to +232
let native_asset = crate::asset::get_native_asset();
if let Some(trace_native_asset) = native_asset.as_trace_prefixed() {
state_tx
.put_ibc_asset(trace_native_asset)
.context("failed to put native asset")?;
} else {
bail!("native asset must not be in ibc/<ID> form")
}
Copy link
Member

Choose a reason for hiding this comment

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

The indent is actually fine - github code wrapping makes this look a bit weird if your window is too narrow.

@SuperFluffy SuperFluffy changed the title fix(sequencer): store native asset ibc->trace mapping in init_chain fix(sequencer)!: store native asset ibc->trace mapping in init_chain Jul 8, 2024
@SuperFluffy
Copy link
Member

Added an exclamation mark, as in fix(sequencer)!, because this isi breaking

@noot noot added this pull request to the merge queue Jul 8, 2024
Merged via the queue into main with commit 38a034b Jul 8, 2024
45 checks passed
@noot noot deleted the noot/native-asset branch July 8, 2024 16:37
steezeburger added a commit that referenced this pull request Jul 15, 2024
* main:
  feat(cli): add cmd to collect withdrawal events and submit as actions (#1261)
  fix(core, bridge, sequencer)!: dismabiguate return addresses (#1266)
  fix(withdrawer): support withdrawer address that differs from bridge address   (#1262)
  (core, sequencer)!: generate serde traits impls for all protocol protobufs (#1260)
  fix(charts): add resources for sequencer/cometbft (#1254)
  chore(sequencer)!: add metrics (#1248)
  fix(sequencer-utils): fixes issue in `parse_blob` tests (#1243)
  feat(core, proto)!: make bridge unlock memo string (#1244)
  fix(conductor): don't panic during panic (#1252)
  feat(core)!: lowerCamelCase for protobuf json mapping (#1250)
  refactor(bridge-withdrawer)!: refactor startup to a separate subtask and remove balance check from startup (#1190)
  fix: rollup archive node configurations (#1249)
  refactor(core, bridge-withdrawer)!: move bridge-unlock memo to core (#1245)
  fix(sequencer)!: store native asset ibc->trace mapping in init_chain (#1242)
bharath-123 pushed a commit that referenced this pull request Jul 25, 2024
…1242)

## Summary
we need to store the native asset ibc to "trace" mapping in the state,
otherwise queries for the native asset using the ID will fail. for
example `get_bridge_account_info` where the asset is the native asset
fails right now

## Changes
-  store native asset ibc->trace mapping in `init_chain`
- also enforce that the native asset is is "trace" form, as otherwise,
we won't be able to map from ibc->trace form for the asset as we don't
know the trace form.

## Breaking changes
- this is unfortunately breaking since the ibc->trace mapping is stored
in app state.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sequencer pertaining to the astria-sequencer crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants