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

integrate ACP-118 #408

Merged
merged 48 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
c46fc41
go.mod: use latest subnet-evm commit
feuGeneA Aug 5, 2024
650c987
integrate w/ACP-118 protobuf SignatureRequest
feuGeneA Aug 5, 2024
a9c7768
test relayer & aggregator: log debug by default
feuGeneA Aug 5, 2024
9db9153
Merge branch 'signature-aggregation-api' into signature-aggregation-a…
feuGeneA Aug 5, 2024
557262a
add justification, rename message to drop Unsigned
feuGeneA Aug 6, 2024
b56e5d3
Merge remote-tracking branch 'origin/signature-aggregation-api' into …
feuGeneA Aug 6, 2024
adb8fb2
Merge remote-tracking branch 'origin/signature-aggregation-api' into …
feuGeneA Aug 7, 2024
f399cff
re-pin dependencies
feuGeneA Aug 7, 2024
fa3dbc0
Merge remote-tracking branch 'origin/signature-aggregation-api' into …
feuGeneA Aug 7, 2024
c771ca9
sync teleporter git submodule to go.mod version
feuGeneA Aug 7, 2024
fa60e03
version bumps, logging and handlerid packing hacks
iansuvak Aug 8, 2024
0108081
Update signature-aggregator/README.md
iansuvak Aug 8, 2024
cf689e5
Update signature-aggregator/README.md
iansuvak Aug 8, 2024
b186d1c
address review feedback
iansuvak Aug 8, 2024
95797af
invert utils.CheckStakeWeightPercentageExceedsThreshold
iansuvak Aug 8, 2024
b8735b0
Fix bugs in api and remove old testing code
iansuvak Aug 8, 2024
0be46eb
bump teleporter submodule
iansuvak Aug 9, 2024
e3cefff
Merge remote-tracking branch 'origin/main' into isuvak/sig-agg-acp-118
iansuvak Aug 9, 2024
79132a1
actually fix versions
iansuvak Aug 9, 2024
b5cff9e
Merge branch 'main' into signature-aggregation-api-acp-118
iansuvak Aug 9, 2024
2f337c9
Merge branch 'signature-aggregation-api-acp-118' into isuvak/sig-agg-…
iansuvak Aug 9, 2024
bce634d
replace feature branch commit references with default branch ones
iansuvak Aug 19, 2024
811c97a
add explicit check for signature length
iansuvak Aug 21, 2024
30a718d
Merge pull request #422 from ava-labs/isuvak/sig-agg-acp-118
iansuvak Aug 21, 2024
9f81123
Merge remote-tracking branch 'origin/main' into signature-aggregation…
feuGeneA Aug 20, 2024
e9eea93
Merge remote-tracking branch 'origin/main' into signature-aggregation…
feuGeneA Aug 21, 2024
29cac30
relay justification from handled request to AppReq
feuGeneA Aug 21, 2024
7fd79dc
Merge branch 'main' into signature-aggregation-api-acp-118
feuGeneA Aug 22, 2024
58af3de
Update signature-aggregator/api/api.go
feuGeneA Aug 23, 2024
e1edf7e
Merge branch 'main' into signature-aggregation-api-acp-118
feuGeneA Aug 23, 2024
70666da
Merge branch 'main' into signature-aggregation-api-acp-118
iansuvak Aug 27, 2024
77262bc
Etna timestamp switch
iansuvak Aug 27, 2024
ec5b830
Fix implementation and add E2E test
iansuvak Aug 28, 2024
0498f4a
update sample workflow docs for sig-agg
iansuvak Aug 28, 2024
440a52d
use PrefixMessage function to construct request bytes
iansuvak Aug 28, 2024
91c5016
make etna upgrade test just test the post-etna case
iansuvak Aug 28, 2024
47cfef6
use extract_commit instead of manually synced references in versions.sh
iansuvak Aug 28, 2024
b87bcc1
Revert "use extract_commit instead of manually synced references in v…
iansuvak Aug 29, 2024
5852f6c
Merge remote-tracking branch 'origin/main' into etna-time
iansuvak Aug 30, 2024
7f9488c
Add TODO to cleanup after Etna release
iansuvak Aug 30, 2024
0648123
Merge pull request #463 from ava-labs/etna-time
iansuvak Aug 30, 2024
ae43d72
Merge branch 'main' into signature-aggregation-api-acp-118
iansuvak Sep 4, 2024
ca06934
adapt to latest changes in `main`
feuGeneA Sep 4, 2024
6cd8245
pass nil, not empty slice
feuGeneA Sep 4, 2024
b04df21
Merge branch 'main' into signature-aggregation-api-acp-118
feuGeneA Sep 4, 2024
3d7707d
address review feedback
iansuvak Sep 5, 2024
2ba7b61
Merge remote-tracking branch 'origin/main' into signature-aggregation…
iansuvak Sep 5, 2024
576a375
address review feedback
iansuvak Sep 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ module github.com/ava-labs/awm-relayer
go 1.21.12

require (
github.com/ava-labs/avalanchego v1.11.10-0.20240718133512-d9ddf0a774e1
github.com/ava-labs/coreth v0.13.6-rc.1.0.20240718130554-0110293d1f4b
github.com/ava-labs/subnet-evm v0.6.8-status-removal.0.20240718155830-1d577b6a5e0b
github.com/ava-labs/avalanchego v1.11.11-0.20240729205337-a0f7e422bb84
github.com/ava-labs/subnet-evm v0.6.9-0.20240802175433-caf34ea35fb4
github.com/ava-labs/teleporter v1.0.3
github.com/aws/aws-sdk-go-v2 v1.30.3
github.com/aws/aws-sdk-go-v2/config v1.27.9
Expand All @@ -26,6 +25,7 @@ require (
)

require (
github.com/ava-labs/coreth v0.13.7 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.9 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.15 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ github.com/alexliesenfeld/health v0.8.0/go.mod h1:TfNP0f+9WQVWMQRzvMUjlws4ceXKEL
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8=
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/ava-labs/avalanchego v1.11.10-0.20240718133512-d9ddf0a774e1 h1:RhyF0H8Rknz4sdYU3+Y8o6I4xodktqf/YzyfDZWKowg=
github.com/ava-labs/avalanchego v1.11.10-0.20240718133512-d9ddf0a774e1/go.mod h1:a+A78rkfjmTRU5k4BksGcAO8tleeyLEKjXOzBbwwAXU=
github.com/ava-labs/coreth v0.13.6-rc.1.0.20240718130554-0110293d1f4b h1:XUc8KVA76s08ZdN92j2IMlKr3g9OGVPf6FlAxea42wI=
github.com/ava-labs/coreth v0.13.6-rc.1.0.20240718130554-0110293d1f4b/go.mod h1:EXQ/+Uk64XTBdMvgmapzy56dZ8xEkbVSgNMpSLkTKos=
github.com/ava-labs/subnet-evm v0.6.8-status-removal.0.20240718155830-1d577b6a5e0b h1:qGNyH3O3VanpbgFW6DbxCAV/qF6QUDs2Ckul6wuEhmg=
github.com/ava-labs/subnet-evm v0.6.8-status-removal.0.20240718155830-1d577b6a5e0b/go.mod h1:Dw/PykU2GR/FPl3Psoi9Pp6HL1qEl8Jm3QcBsBKobBQ=
github.com/ava-labs/avalanchego v1.11.11-0.20240729205337-a0f7e422bb84 h1:AmPZLlnVREbJ/viK/hDTIVn1bqX8QTB2CFtrBxHwnsw=
github.com/ava-labs/avalanchego v1.11.11-0.20240729205337-a0f7e422bb84/go.mod h1:POgZPryqe80OeHCDNrXrPOKoFre736iFuMgmUBeKaLc=
github.com/ava-labs/coreth v0.13.7 h1:k8T9u/ROifl8f7oXjHRc1KvSISRl9txvy7gGVmHEz6g=
github.com/ava-labs/coreth v0.13.7/go.mod h1:tXDujonxXFOF6oK5HS2EmgtSXJK3Gy6RpZxb5WzR9rM=
github.com/ava-labs/subnet-evm v0.6.9-0.20240802175433-caf34ea35fb4 h1:hD67mjzCx9yb7JNHHEb/g50BHx2NTdceEx6f72kMUuc=
github.com/ava-labs/subnet-evm v0.6.9-0.20240802175433-caf34ea35fb4/go.mod h1:BryiYmD6HWmugkSUpDdj/KyMi7ou5pJzPRNPMbMgpbA=
github.com/ava-labs/teleporter v1.0.3 h1:5Kwso1yk5dtuIg7356MF+cJFRFge8nvun/JK0MDAUAM=
github.com/ava-labs/teleporter v1.0.3/go.mod h1:h8wp8x7531OLeyQUzC2M20S6AVXSuj598Hmo8QSUVOM=
github.com/aws/aws-sdk-go-v2 v1.30.3 h1:jUeBtG0Ih+ZIFH0F4UkmL9w3cSpaMv9tYYDbzILP8dY=
Expand Down
23 changes: 5 additions & 18 deletions signature-aggregator/aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ import (
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/message"
"github.com/ava-labs/avalanchego/proto/pb/p2p"
"github.com/ava-labs/avalanchego/proto/pb/sdk"
"github.com/ava-labs/avalanchego/subnets"
"github.com/ava-labs/avalanchego/utils/constants"
"github.com/ava-labs/avalanchego/utils/crypto/bls"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/set"
avalancheWarp "github.com/ava-labs/avalanchego/vms/platformvm/warp"
"github.com/ava-labs/awm-relayer/peers"
"github.com/ava-labs/awm-relayer/utils"
coreEthMsg "github.com/ava-labs/coreth/plugin/evm/message"
msg "github.com/ava-labs/subnet-evm/plugin/evm/message"
"go.uber.org/zap"
"google.golang.org/protobuf/proto"
)

type blsSignatureBuf [bls.SignatureLen]byte
Expand All @@ -40,9 +40,6 @@ const (
)

var (
codec = msg.Codec
coreEthCodec = coreEthMsg.Codec

// Errors
errNotEnoughSignatures = errors.New("failed to collect a threshold of signatures")
errNotEnoughConnectedStake = errors.New("failed to connect to a threshold of stake")
Expand Down Expand Up @@ -121,19 +118,9 @@ func (s *SignatureAggregator) AggregateSignaturesAppRequest(
return nil, errNotEnoughConnectedStake
}

// TODO: remove this special handling and replace with ACP-118 interface once available
var reqBytes []byte
if sourceSubnet == constants.PrimaryNetworkID {
req := coreEthMsg.MessageSignatureRequest{
MessageID: unsignedMessage.ID(),
}
reqBytes, err = coreEthMsg.RequestToBytes(coreEthCodec, req)
} else {
req := msg.MessageSignatureRequest{
MessageID: unsignedMessage.ID(),
}
reqBytes, err = msg.RequestToBytes(codec, req)
}
reqBytes, err := proto.Marshal(
&sdk.SignatureRequest{Message: unsignedMessage.Bytes()},
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add justification bytes here as well as the API. In the API they should be hex encoded and since their meaning is VM specific we don't need to do any processing to them either just like with the message. We should only pass the non-zero fields since the ACP-118 spec but in the API layer we should do validation that at least one of message, justification fields is non-zero.

I would also rename our API to use Message instead of UnsignedMessage to match the ACP-118 spec while we are at it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in 557262a

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This isn't done yet. I added the justification everywhere (in the API) except for right here 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

last piece addressed in 29cac30

)
if err != nil {
msg := "Failed to marshal request bytes"
s.logger.Error(
Expand Down
Loading