mirror of
https://github.com/luxfi/evm.git
synced 2026-09-24 00:27:44 +00:00
chain routes: /v1/bc -> /v1/chain
luxd serves chain routes under /v1/chain, and the node, cli and sdk releases already ship it. The deployed gateways still answer the old prefix, so remote reads break until they are redeployed; the estate moves together rather than sitting half converted. Lines that record an observation - a probe, a status code, a past release - keep the prefix they were written against, as do URLs on hosts that are not ours. Avalanche endpoints move to /ext/bc, which is the path that host serves. Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
@@ -115,7 +115,7 @@ func BuildFlagSet() *pflag.FlagSet {
|
||||
func addSimulatorFlags(fs *pflag.FlagSet) {
|
||||
fs.Bool(VersionKey, false, "Print the version and exit")
|
||||
fs.String(ConfigFilePathKey, "", "Specify the config path to use to load a YAML config for the simulator")
|
||||
fs.StringSlice(EndpointsKey, []string{"ws://127.0.0.1:9630/v1/bc/C/ws"}, "Specify a comma separated list of RPC Websocket Endpoints (minimum of 1 endpoint)")
|
||||
fs.StringSlice(EndpointsKey, []string{"ws://127.0.0.1:9630/v1/chain/C/ws"}, "Specify a comma separated list of RPC Websocket Endpoints (minimum of 1 endpoint)")
|
||||
fs.Int64(MaxFeeCapKey, 50, "Specify the maximum fee cap to use for transactions denominated in GWei (must be > 0)")
|
||||
fs.Int64(MaxTipCapKey, 1, "Specify the max tip cap for transactions denominated in GWei (must be >= 0)")
|
||||
fs.Uint64(TxsPerWorkerKey, 100, "Specify the number of transactions to create per worker (must be > 0)")
|
||||
|
||||
@@ -3,7 +3,7 @@ import "./tasks"
|
||||
|
||||
// HardHat users must populate these environment variables in order to connect to their evm instance
|
||||
// Since the blockchainID is not known in advance, there's no good default to use and we use the C-Chain here.
|
||||
var local_rpc_uri = process.env.RPC_URI || "http://127.0.0.1:9650/v1/bc/C/rpc"
|
||||
var local_rpc_uri = process.env.RPC_URI || "http://127.0.0.1:9650/v1/chain/C/rpc"
|
||||
var local_chain_id = parseInt(process.env.CHAIN_ID, 10) || 99999
|
||||
|
||||
export default {
|
||||
@@ -19,7 +19,7 @@ export default {
|
||||
},
|
||||
networks: {
|
||||
local: {
|
||||
//"http://{ip}:{port}/v1/bc/{chainID}/rpc
|
||||
//"http://{ip}:{port}/v1/chain/{chainID}/rpc
|
||||
// expected to be populated by the environment variables above
|
||||
url: local_rpc_uri,
|
||||
chainId: local_chain_id,
|
||||
|
||||
@@ -49,7 +49,7 @@ type client struct {
|
||||
|
||||
// NewClient returns a Client for interacting with EVM [chain]
|
||||
func NewClient(uri, chain string) Client {
|
||||
requestUri := fmt.Sprintf("%s/v1/bc/%s", uri, chain)
|
||||
requestUri := fmt.Sprintf("%s/v1/chain/%s", uri, chain)
|
||||
return NewClientWithURL(requestUri)
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ func TestNewClientRequestsV1Paths(t *testing.T) {
|
||||
}
|
||||
|
||||
got := <-seen
|
||||
if want := "/v1/bc/C/admin"; got != want {
|
||||
if want := "/v1/chain/C/admin"; got != want {
|
||||
t.Fatalf("admin endpoint = %q, want %q", got, want)
|
||||
}
|
||||
if strings.Contains(got, "/ext/") {
|
||||
@@ -41,7 +41,7 @@ func TestNewClientRequestsV1Paths(t *testing.T) {
|
||||
if _, err := c.GetCurrentValidators(context.Background(), nil); err != nil {
|
||||
t.Fatalf("GetCurrentValidators: %v", err)
|
||||
}
|
||||
if got, want := <-seen, "/v1/bc/C/validators"; got != want {
|
||||
if got, want := <-seen, "/v1/chain/C/validators"; got != want {
|
||||
t.Fatalf("validators endpoint = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ func TestNewClientUsesChainArgument(t *testing.T) {
|
||||
if err := NewClient(srv.URL, chainID).StartCPUProfiler(context.Background()); err != nil {
|
||||
t.Fatalf("StartCPUProfiler: %v", err)
|
||||
}
|
||||
if got, want := <-seen, "/v1/bc/"+chainID+"/admin"; got != want {
|
||||
if got, want := <-seen, "/v1/chain/"+chainID+"/admin"; got != want {
|
||||
t.Fatalf("endpoint = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ var _ = ginkgo.Describe("[Load Simulator]", ginkgo.Ordered, func() {
|
||||
if !validatorIDs.Contains(nodeURI.NodeID) {
|
||||
continue
|
||||
}
|
||||
rpcEndpoints = append(rpcEndpoints, fmt.Sprintf("%s/v1/bc/%s/rpc", nodeURI.URI, blockchainID))
|
||||
rpcEndpoints = append(rpcEndpoints, fmt.Sprintf("%s/v1/chain/%s/rpc", nodeURI.URI, blockchainID))
|
||||
}
|
||||
commaSeparatedRPCEndpoints := strings.Join(rpcEndpoints, ",")
|
||||
require.NoError(os.Setenv("RPC_ENDPOINTS", commaSeparatedRPCEndpoints))
|
||||
|
||||
@@ -175,7 +175,7 @@ func CreateNewSubnet(ctx context.Context, genesisFilePath string) string {
|
||||
|
||||
// GetDefaultChainURI returns the default chain URI for a given blockchainID
|
||||
func GetDefaultChainURI(blockchainID string) string {
|
||||
return fmt.Sprintf("%s/v1/bc/%s/rpc", DefaultLocalNodeURI, blockchainID)
|
||||
return fmt.Sprintf("%s/v1/chain/%s/rpc", DefaultLocalNodeURI, blockchainID)
|
||||
}
|
||||
|
||||
// GetFilesAndAliases returns a map of aliases to file paths in given [dir].
|
||||
|
||||
@@ -752,9 +752,9 @@ func generateKeys(preFundedKey *ecdsa.PrivateKey, numWorkers int) ([]*key.Key, [
|
||||
}
|
||||
|
||||
func toWebsocketURI(uri string, blockchainID string) string {
|
||||
return fmt.Sprintf("ws://%s/v1/bc/%s/ws", strings.TrimPrefix(uri, "http://"), blockchainID)
|
||||
return fmt.Sprintf("ws://%s/v1/chain/%s/ws", strings.TrimPrefix(uri, "http://"), blockchainID)
|
||||
}
|
||||
|
||||
func toRPCURI(uri string, blockchainID string) string {
|
||||
return fmt.Sprintf("%s/v1/bc/%s/rpc", uri, blockchainID)
|
||||
return fmt.Sprintf("%s/v1/chain/%s/rpc", uri, blockchainID)
|
||||
}
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ type client struct {
|
||||
|
||||
// NewClient returns a Client for interacting with EVM [chain]
|
||||
func NewClient(uri, chain string) (Client, error) {
|
||||
innerClient, err := rpc.Dial(fmt.Sprintf("%s/v1/bc/%s/rpc", uri, chain))
|
||||
innerClient, err := rpc.Dial(fmt.Sprintf("%s/v1/chain/%s/rpc", uri, chain))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to dial client. err: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user