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 initialization for the genesis base asset contract #2304

Merged

Conversation

xgreenx
Copy link
Collaborator

@xgreenx xgreenx commented Oct 6, 2024

This match initializes storage slots for the genesis base asset contract(because we forgot to add it).
In the next release we will remove it form our codebase=)

Side change:

  • Moves ChangesIterator to the fuel-core-storage crate to allow usage in the tests.

Checklist

  • New behavior is reflected in tests

Before requesting review

  • I have reviewed the code myself

@xgreenx xgreenx requested a review from a team October 6, 2024 23:23
@xgreenx xgreenx self-assigned this Oct 6, 2024
@xgreenx xgreenx enabled auto-merge (squash) October 6, 2024 23:43
@xgreenx xgreenx merged commit 8fa66f2 into master Oct 6, 2024
32 checks passed
@xgreenx xgreenx deleted the hotfix/initialize-state-of-the-genesis-base-contract branch October 6, 2024 23:56
Copy link
Member

@rymnc rymnc left a comment

Choose a reason for hiding this comment

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

left a couple qs

let key = ContractsStateKey::new(contract_id, &storage_key);
let contains = storage
.storage_as_mut::<ContractsState>()
.contains_key(&key)?;
Copy link
Member

Choose a reason for hiding this comment

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

qq: what was the previous value stored in the keys defined by STATE? does zeroing them out fix it?

Comment on lines +127 to +130
let entries = view
.iter_all::<ContractsState>(None)
.map(|r| r.unwrap())
.collect::<Vec<_>>();
Copy link
Member

Choose a reason for hiding this comment

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

iter_all_keys perhaps? but then again, we don't test the values and this length would be the same before and after running maybe_fix_contract right?

@xgreenx xgreenx mentioned this pull request Oct 7, 2024
xgreenx added a commit that referenced this pull request Oct 7, 2024
## Version v0.37.1

### Fixed
- [2304](#2304): Add
initialization for the genesis base asset contract.

## What's Changed
* Add initialization for the genesis base asset contract by @xgreenx in
#2304


**Full Changelog**:
v0.37.0...v0.37.1
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