diff --git a/examples/morpheusvm/go.mod b/examples/morpheusvm/go.mod index 953aeccaf7..fc742a830e 100644 --- a/examples/morpheusvm/go.mod +++ b/examples/morpheusvm/go.mod @@ -3,7 +3,7 @@ module github.com/ava-labs/hypersdk/examples/morpheusvm go 1.21.12 require ( - github.com/ava-labs/avalanchego v1.11.11-0.20240827034238-fc892827880a + github.com/ava-labs/avalanchego v1.11.12-0.20240905030632-718128aacc19 github.com/ava-labs/hypersdk v0.0.1 github.com/fatih/color v1.13.0 github.com/onsi/ginkgo/v2 v2.13.1 @@ -16,7 +16,7 @@ require ( github.com/DataDog/zstd v1.5.2 // indirect github.com/NYTimes/gziphandler v1.1.1 // indirect github.com/VictoriaMetrics/fastcache v1.12.1 // indirect - github.com/ava-labs/coreth v0.13.8-0.20240802110637-b3e5088d062d // indirect + github.com/ava-labs/coreth v0.13.8-fixed-genesis-upgrade.0.20240815193440-a96bc921e732 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect diff --git a/examples/morpheusvm/go.sum b/examples/morpheusvm/go.sum index 64379b5ab5..a87aa83939 100644 --- a/examples/morpheusvm/go.sum +++ b/examples/morpheusvm/go.sum @@ -58,10 +58,10 @@ github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY 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.11-0.20240827034238-fc892827880a h1:TMhT+mI6R1szbDPJFJXVquDnpZX3RJ+HH127K4Fdo3Q= -github.com/ava-labs/avalanchego v1.11.11-0.20240827034238-fc892827880a/go.mod h1:9e0UPXJboybmgFjeTj+SFbK4ugbrdG4t68VdiUW5oQ8= -github.com/ava-labs/coreth v0.13.8-0.20240802110637-b3e5088d062d h1:klPTcKVvqfA2KSKaRvQAO56Pd4XAqGhwgMTQ6/W+w7w= -github.com/ava-labs/coreth v0.13.8-0.20240802110637-b3e5088d062d/go.mod h1:tXDujonxXFOF6oK5HS2EmgtSXJK3Gy6RpZxb5WzR9rM= +github.com/ava-labs/avalanchego v1.11.12-0.20240905030632-718128aacc19 h1:p7nUMQ5/R8l2XdDUlEcJgf4KDW7ZyeqKVfYg6bSnpLg= +github.com/ava-labs/avalanchego v1.11.12-0.20240905030632-718128aacc19/go.mod h1:yFx3V31Jy9NFa8GZlgGnwiVf8KGjeF2+Uc99l9Scd/8= +github.com/ava-labs/coreth v0.13.8-fixed-genesis-upgrade.0.20240815193440-a96bc921e732 h1:wlhGJbmb7s3bU2QWtxKjscGjfHknQiq+cVhhUjONsB8= +github.com/ava-labs/coreth v0.13.8-fixed-genesis-upgrade.0.20240815193440-a96bc921e732/go.mod h1:RkQLaQ961Xe/sUb3ycn4Qi18vPPuEetTqDf2eDcquAs= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= diff --git a/go.mod b/go.mod index f271d11b40..53d1f4befc 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/ava-labs/hypersdk go 1.21.12 require ( - github.com/ava-labs/avalanchego v1.11.11-0.20240827034238-fc892827880a + github.com/ava-labs/avalanchego v1.11.12-0.20240905030632-718128aacc19 github.com/btcsuite/btcd/btcutil v1.1.3 github.com/bytecodealliance/wasmtime-go/v14 v14.0.0 github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593 @@ -38,7 +38,7 @@ require ( github.com/DataDog/zstd v1.5.2 // indirect github.com/NYTimes/gziphandler v1.1.1 // indirect github.com/VictoriaMetrics/fastcache v1.12.1 // indirect - github.com/ava-labs/coreth v0.13.8-0.20240802110637-b3e5088d062d // indirect + github.com/ava-labs/coreth v0.13.8-fixed-genesis-upgrade.0.20240815193440-a96bc921e732 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect diff --git a/go.sum b/go.sum index 3edddc0d1c..0d68de80fb 100644 --- a/go.sum +++ b/go.sum @@ -58,10 +58,10 @@ github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY 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.11-0.20240827034238-fc892827880a h1:TMhT+mI6R1szbDPJFJXVquDnpZX3RJ+HH127K4Fdo3Q= -github.com/ava-labs/avalanchego v1.11.11-0.20240827034238-fc892827880a/go.mod h1:9e0UPXJboybmgFjeTj+SFbK4ugbrdG4t68VdiUW5oQ8= -github.com/ava-labs/coreth v0.13.8-0.20240802110637-b3e5088d062d h1:klPTcKVvqfA2KSKaRvQAO56Pd4XAqGhwgMTQ6/W+w7w= -github.com/ava-labs/coreth v0.13.8-0.20240802110637-b3e5088d062d/go.mod h1:tXDujonxXFOF6oK5HS2EmgtSXJK3Gy6RpZxb5WzR9rM= +github.com/ava-labs/avalanchego v1.11.12-0.20240905030632-718128aacc19 h1:p7nUMQ5/R8l2XdDUlEcJgf4KDW7ZyeqKVfYg6bSnpLg= +github.com/ava-labs/avalanchego v1.11.12-0.20240905030632-718128aacc19/go.mod h1:yFx3V31Jy9NFa8GZlgGnwiVf8KGjeF2+Uc99l9Scd/8= +github.com/ava-labs/coreth v0.13.8-fixed-genesis-upgrade.0.20240815193440-a96bc921e732 h1:wlhGJbmb7s3bU2QWtxKjscGjfHknQiq+cVhhUjONsB8= +github.com/ava-labs/coreth v0.13.8-fixed-genesis-upgrade.0.20240815193440-a96bc921e732/go.mod h1:RkQLaQ961Xe/sUb3ycn4Qi18vPPuEetTqDf2eDcquAs= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= diff --git a/internal/network/network.go b/internal/network/network.go index edabb3aefd..b3f7531d83 100644 --- a/internal/network/network.go +++ b/internal/network/network.go @@ -70,10 +70,6 @@ type Handler interface { requestID uint32, response []byte, ) error - - CrossChainAppRequest(context.Context, ids.ID, uint32, time.Time, []byte) error - CrossChainAppRequestFailed(context.Context, ids.ID, uint32) error - CrossChainAppResponse(context.Context, ids.ID, uint32, []byte) error } func (n *Manager) Register() (uint8, common.AppSender) { @@ -273,60 +269,6 @@ func (n *Manager) Disconnected(ctx context.Context, nodeID ids.NodeID) error { return nil } -func (n *Manager) CrossChainAppRequest( - ctx context.Context, - chainID ids.ID, - requestID uint32, - deadline time.Time, - msg []byte, -) error { - parsedMsg, handler, ok := n.routeIncomingMessage(msg) - if !ok { - n.log.Debug( - "could not route incoming CrossChainAppRequest", - zap.Stringer("chainID", chainID), - zap.Uint32("requestID", requestID), - ) - return nil - } - return handler.CrossChainAppRequest(ctx, chainID, requestID, deadline, parsedMsg) -} - -func (n *Manager) CrossChainAppRequestFailed( - ctx context.Context, - chainID ids.ID, - requestID uint32, -) error { - handler, cRequestID, ok := n.handleSharedRequestID(n.nodeID, requestID) - if !ok { - n.log.Debug( - "could not handle incoming CrossChainAppRequestFailed", - zap.Stringer("chainID", chainID), - zap.Uint32("requestID", requestID), - ) - return nil - } - return handler.CrossChainAppRequestFailed(ctx, chainID, cRequestID) -} - -func (n *Manager) CrossChainAppResponse( - ctx context.Context, - chainID ids.ID, - requestID uint32, - response []byte, -) error { - handler, cRequestID, ok := n.handleSharedRequestID(n.nodeID, requestID) - if !ok { - n.log.Debug( - "could not handle incoming CrossChainAppResponse", - zap.Stringer("chainID", chainID), - zap.Uint32("requestID", requestID), - ) - return nil - } - return handler.CrossChainAppResponse(ctx, chainID, cRequestID, response) -} - // WrappedAppSender is used to get a shared requestID and to prepend messages // with the handler identifier. type WrappedAppSender struct { @@ -403,57 +345,6 @@ func (w *WrappedAppSender) SendAppGossip(ctx context.Context, cfg common.SendCon ) } -// SendCrossChainAppRequest sends an application-level request to a -// specific chain. -// -// A nil return value guarantees that the VM corresponding to this -// CrossChainAppSender eventually receives either: -// * A CrossChainAppResponse from [chainID] with ID [requestID] -// * A CrossChainAppRequestFailed from [chainID] with ID [requestID] -// Exactly one of the above messages will eventually be received from -// [chainID]. -// A non-nil error should be considered fatal. -func (w *WrappedAppSender) SendCrossChainAppRequest( - ctx context.Context, - chainID ids.ID, - requestID uint32, - appRequestBytes []byte, -) error { - newRequestID := w.n.getSharedRequestID(w.handler, w.n.nodeID, requestID) - return w.n.sender.SendCrossChainAppRequest( - ctx, - chainID, - newRequestID, - w.createMessageBytes(appRequestBytes), - ) -} - -// SendCrossChainAppResponse sends an application-level response to a -// specific chain -// -// This response must be in response to a CrossChainAppRequest that the VM -// corresponding to this CrossChainAppSender received from [chainID] with ID -// [requestID]. -// A non-nil error should be considered fatal. -func (w *WrappedAppSender) SendCrossChainAppResponse( - ctx context.Context, - chainID ids.ID, - requestID uint32, - appResponseBytes []byte, -) error { - // We don't need to wrap this response because the sender should know what - // requestID is associated with which handler. - return w.n.sender.SendCrossChainAppResponse(ctx, chainID, requestID, appResponseBytes) -} - -// SendCrossChainAppError sends an application-level error to a CrossChainAppRequest -func (w *WrappedAppSender) SendCrossChainAppError( - ctx context.Context, chainID ids.ID, requestID uint32, errorCode int32, - errorMessage string, -) error { - return w.n.sender.SendCrossChainAppError(ctx, chainID, requestID, errorCode, errorMessage) -} - func (w *WrappedAppSender) createMessageBytes(src []byte) []byte { messageBytes := make([]byte, 1+len(src)) messageBytes[0] = w.handler diff --git a/vm/network_state_sync.go b/vm/network_state_sync.go index 5c15e906e4..8554f4a459 100644 --- a/vm/network_state_sync.go +++ b/vm/network_state_sync.go @@ -64,21 +64,3 @@ func (s *StateSyncHandler) AppResponse( ) error { return s.vm.stateSyncNetworkClient.AppResponse(ctx, nodeID, requestID, response) } - -func (*StateSyncHandler) CrossChainAppRequest( - context.Context, - ids.ID, - uint32, - time.Time, - []byte, -) error { - return nil -} - -func (*StateSyncHandler) CrossChainAppRequestFailed(context.Context, ids.ID, uint32) error { - return nil -} - -func (*StateSyncHandler) CrossChainAppResponse(context.Context, ids.ID, uint32, []byte) error { - return nil -} diff --git a/vm/network_tx_gossip.go b/vm/network_tx_gossip.go index 83cd31d98f..abe20b9f38 100644 --- a/vm/network_tx_gossip.go +++ b/vm/network_tx_gossip.go @@ -63,21 +63,3 @@ func (*TxGossipHandler) AppResponse( ) error { return nil } - -func (*TxGossipHandler) CrossChainAppRequest( - context.Context, - ids.ID, - uint32, - time.Time, - []byte, -) error { - return nil -} - -func (*TxGossipHandler) CrossChainAppRequestFailed(context.Context, ids.ID, uint32) error { - return nil -} - -func (*TxGossipHandler) CrossChainAppResponse(context.Context, ids.ID, uint32, []byte) error { - return nil -} diff --git a/vm/vm.go b/vm/vm.go index bd181e63af..7a59368bf1 100644 --- a/vm/vm.go +++ b/vm/vm.go @@ -1037,44 +1037,6 @@ func (vm *VM) AppResponse( return vm.networkManager.AppResponse(ctx, nodeID, requestID, response) } -func (vm *VM) CrossChainAppRequest( - ctx context.Context, - nodeID ids.ID, - requestID uint32, - deadline time.Time, - request []byte, -) error { - ctx, span := vm.tracer.Start(ctx, "VM.CrossChainAppRequest") - defer span.End() - - return vm.networkManager.CrossChainAppRequest(ctx, nodeID, requestID, deadline, request) -} - -func (vm *VM) CrossChainAppRequestFailed( - ctx context.Context, - nodeID ids.ID, - requestID uint32, - _ *common.AppError, -) error { - ctx, span := vm.tracer.Start(ctx, "VM.CrossChainAppRequestFailed") - defer span.End() - - // TODO: add support for handling common.AppError - return vm.networkManager.CrossChainAppRequestFailed(ctx, nodeID, requestID) -} - -func (vm *VM) CrossChainAppResponse( - ctx context.Context, - nodeID ids.ID, - requestID uint32, - response []byte, -) error { - ctx, span := vm.tracer.Start(ctx, "VM.CrossChainAppResponse") - defer span.End() - - return vm.networkManager.CrossChainAppResponse(ctx, nodeID, requestID, response) -} - // implements "block.ChainVM.commom.VM.validators.Connector" func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, v *version.Application) error { ctx, span := vm.tracer.Start(ctx, "VM.Connected")