Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
burrow
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hang Yu
burrow
Commits
4a4528b7
Unverified
Commit
4a4528b7
authored
6 years ago
by
Silas Davis
Browse files
Options
Downloads
Patches
Plain Diff
Ensure storing zero value removes the key rather than panics
Signed-off-by:
Silas Davis
<
silas@monax.io
>
parent
cb73b3b2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
account/state/state.go
+1
-1
1 addition, 1 deletion
account/state/state.go
execution/state.go
+5
-1
5 additions, 1 deletion
execution/state.go
with
6 additions
and
2 deletions
account/state/state.go
+
1
−
1
View file @
4a4528b7
...
...
@@ -33,7 +33,7 @@ type StorageGetter interface {
}
type
StorageSetter
interface
{
// Store a 32-byte value at key for the account at address
// Store a 32-byte value at key for the account at address
, setting to Zero256 removes the key
SetStorage
(
address
acm
.
Address
,
key
,
value
binary
.
Word256
)
error
}
...
...
This diff is collapsed.
Click to expand it.
execution/state.go
+
5
−
1
View file @
4a4528b7
...
...
@@ -235,7 +235,11 @@ func (s *State) GetStorage(address acm.Address, key binary.Word256) (binary.Word
func
(
s
*
State
)
SetStorage
(
address
acm
.
Address
,
key
,
value
binary
.
Word256
)
error
{
s
.
Lock
()
defer
s
.
Unlock
()
s
.
tree
.
Set
(
prefixedKey
(
storagePrefix
,
address
.
Bytes
(),
key
.
Bytes
()),
value
.
Bytes
())
if
value
==
binary
.
Zero256
{
s
.
tree
.
Remove
(
key
.
Bytes
())
}
else
{
s
.
tree
.
Set
(
prefixedKey
(
storagePrefix
,
address
.
Bytes
(),
key
.
Bytes
()),
value
.
Bytes
())
}
return
nil
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment