-
Notifications
You must be signed in to change notification settings - Fork 710
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
pallet_revive: Switch to 64bit RISC-V #6565
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
438d74c
revive: Switch to 64bit RISC-V
athei 6039184
Update from athei running command 'prdoc --audience runtime_dev'
actions-user 9eedfb6
Update from athei running command 'fmt'
actions-user 0213e73
Merge branch 'master' into at/revive_64
athei 1006b5c
Enforce programs to be 64bit on upload
athei 97fea35
Always disable the cache
athei eb98c5b
Check when downcasting host function arguments
athei 4cbcedd
Add env variable to allow the use of compiler
athei 0375550
Merge branch 'master' into at/revive_64
athei b383146
Fix dead code warning
athei 93aa4c9
Merge branch 'master' into at/revive_64
athei ab34df5
Reject 32bit programs on execution
athei 1c8043c
Disable tests that need new fixtures
athei 68ce204
Merge branch 'master' into at/revive_64
athei 0e96609
Merge branch 'master' into at/revive_64
athei 48a39c2
Bump fixture toolchain
athei c1b4474
Revert "Bump fixture toolchain"
athei 58d3c76
Revert "Check when downcasting host function arguments"
athei 518037b
Merge branch 'master' into at/revive_64
athei 16eea42
Merge branch 'master' into at/revive_64
athei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
title: 'pallet_revive: Switch to 64bit RISC-V' | ||
doc: | ||
- audience: Runtime Dev | ||
description: |- | ||
This PR updates pallet_revive to the newest PolkaVM version and adapts the test fixtures and syscall interface to work under 64bit. | ||
|
||
Please note that after this PR no 32bit contracts can be deployed (they will be rejected at deploy time). Pre-deployed 32bit contracts are now considered defunct since we changes how parameters are passed for functions with more than 6 arguments. | ||
|
||
## Fixtures | ||
|
||
The fixtures are now built for the 64bit target. I also removed the temporary directory mechanism that triggered a full rebuild every time. It also makes it easier to find the compiled fixtures since they are now always in `target/pallet-revive-fixtures`. | ||
|
||
## Syscall interface | ||
|
||
### Passing pointer | ||
|
||
Registers and pointers are now 64bit wide. This allows us to pass u64 arguments in a single register. Before we needed two registers to pass them. This means that just as before we need one register per pointer we pass. We keep pointers as `u32` argument by truncating the register. This is done since the memory space of PolkaVM is 32bit. | ||
|
||
### Functions with more than 6 arguments | ||
|
||
We only have 6 registers to pass arguments. This is why we pass a pointer to a struct when we need more than 6. Before this PR we expected a packed struct and interpreted it as SCALE encoded tuple. However, this was buggy because the `MaxEncodedLen` returned something that was larger than the packed size of the structure. This wasn't a problem before. But now the memory space changed in a way that things were placed at the edges of the memory space and those extra bytes lead to an out of bound access. | ||
|
||
This is why this PR drops SCALE and expects the arguments to be passed as a pointer to a `C` aligned struct. This avoids unaligned accesses. However, revive needs to adapt its codegen to properly align the structure fields. | ||
|
||
## TODO | ||
- [ ] Add multi block migration that wipes all existing contracts as we made breaking changes to the syscall interface | ||
crates: | ||
- name: pallet-revive | ||
bump: major | ||
- name: pallet-revive-fixtures | ||
bump: major | ||
- name: pallet-revive-proc-macro | ||
bump: major | ||
- name: pallet-revive-uapi | ||
bump: major |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer needed because I renamed the file to
_Cargo.toml
.