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
94f21e79
Unverified
Commit
94f21e79
authored
8 years ago
by
Silas Davis
Browse files
Options
Downloads
Patches
Plain Diff
use last 20 bytes of sha3 hash for address
parent
4ecc033f
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
manager/eris-mint/evm/snative.go
+3
-2
3 additions, 2 deletions
manager/eris-mint/evm/snative.go
manager/eris-mint/evm/snative_test.go
+1
-1
1 addition, 1 deletion
manager/eris-mint/evm/snative_test.go
with
4 additions
and
3 deletions
manager/eris-mint/evm/snative.go
+
3
−
2
View file @
94f21e79
...
...
@@ -247,11 +247,12 @@ func (contract *SNativeContractDescription) Dispatch(appState AppState,
return
function
.
F
(
appState
,
caller
,
remainingArgs
,
gas
)
}
// We define the address of an SNative contact as the
fir
st 20 bytes of the sha3
// We define the address of an SNative contact as the
la
st 20 bytes of the sha3
// hash of its name
func
(
contract
*
SNativeContractDescription
)
Address
()
abi
.
Address
{
var
address
abi
.
Address
copy
(
address
[
:
],
sha3
.
Sha3
([]
byte
(
contract
.
Name
))[
:
abi
.
AddressLength
])
hash
:=
sha3
.
Sha3
([]
byte
(
contract
.
Name
))
copy
(
address
[
:
],
hash
[
len
(
hash
)
-
abi
.
AddressLength
:
])
return
address
}
...
...
This diff is collapsed.
Click to expand it.
manager/eris-mint/evm/snative_test.go
+
1
−
1
View file @
94f21e79
...
...
@@ -97,7 +97,7 @@ func TestSNativeContractDescription_Dispatch(t *testing.T) {
func
TestSNativeContractDescription_Address
(
t
*
testing
.
T
)
{
contract
:=
NewSNativeContract
(
"A comment"
,
"CoolButVeryLongNamedContractOfDoom"
)
assert
.
Equal
(
t
,
sha3
.
Sha3
(([]
byte
)(
contract
.
Name
))[
:
20
],
contract
.
AddressBytes
())
assert
.
Equal
(
t
,
sha3
.
Sha3
(([]
byte
)(
contract
.
Name
))[
12
:
],
contract
.
AddressBytes
())
}
//
...
...
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