Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit b85fbee

Browse files
Merge pull request #88 from ava-labs/networks
Ledger Fix + Networks
2 parents 84329a2 + 38b654d commit b85fbee

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,3 @@ genesis.json
5454
*.test
5555

5656
dist/
57-
networks/

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,11 +512,13 @@ _Can use this to get the current fee rate._
512512
## Running the VM
513513
To build the VM (and `spaces-cli`), run `./scripts/build.sh`.
514514

515-
### Joining the public beta
515+
### Joining the Spaces Demo
516516
If you'd like to become a validator on the demo, reach out to @\_patrickogrady on Twitter
517517
after you've joined the network and synced to tip. Please send a screenshot
518518
indicating you've done this successfully.
519519

520+
You can find the genesis used for the Spaces Demo in `networks/42`.
521+
520522
### Running a local network
521523
[`scripts/run.sh`](scripts/run.sh) automatically installs [avalanchego](https://github.com/ava-labs/avalanchego), sets up a local network,
522524
and creates a `spacesvm` genesis file. To build and run E2E tests, you need to set the variable `E2E` before it: `E2E=true ./scripts/run.sh 1.7.4`

chain/crypto.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
)
1111

1212
const (
13+
vOffset = 64
1314
legacySigAdj = 27
1415
)
1516

@@ -18,7 +19,7 @@ func Sign(dh []byte, priv *ecdsa.PrivateKey) ([]byte, error) {
1819
if err != nil {
1920
return nil, err
2021
}
21-
sig[64] += legacySigAdj
22+
sig[vOffset] += legacySigAdj
2223
return sig, nil
2324
}
2425

@@ -29,6 +30,10 @@ func DeriveSender(dh []byte, sig []byte) (*ecdsa.PublicKey, error) {
2930
// Avoid modifying the signature in place in case it is used elsewhere
3031
sigcpy := make([]byte, crypto.SignatureLength)
3132
copy(sigcpy, sig)
32-
sigcpy[64] -= legacySigAdj
33+
34+
// Support signers that don't apply offset (ex: ledger)
35+
if sigcpy[vOffset] >= legacySigAdj {
36+
sigcpy[vOffset] -= legacySigAdj
37+
}
3338
return crypto.SigToPub(dh, sigcpy)
3439
}

networks/42/allocations-42.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[
2+
{"address":"0x6f0f6DA1852857d7789f68a28bba866671f3880D", "balance":9223372036854775807}
3+
]

networks/42/genesis-42.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"magic":42,"baseTxUnits":1,"valueUnitSize":1024,"maxValueSize":204800,"valueExpiryDiscount":10,"claimLoadMultiplier":5,"minClaimFee":100,"spaceDesirabilityMultiplier":5,"spaceRenewalDiscount":10,"claimReward":2654208000,"claimExpiryUnits":100,"lotteryRewardMultipler":50,"minPrice":1,"lookbackWindow":60,"targetBlockRate":1,"targetBlockSize":225,"maxBlockSize":246,"blockCostEnabled":true,"customAllocation":[{"address":"0x6f0f6da1852857d7789f68a28bba866671f3880d","balance":9223372036854775807}],"airdropHash":"0xccbf8e430b30d08b5b3342208781c40b373d1b5885c1903828f367230a2568da","airdropUnits":10000}

0 commit comments

Comments
 (0)