-
Notifications
You must be signed in to change notification settings - Fork 0
/
artifactsfs_test.go
43 lines (38 loc) · 1.3 KB
/
artifactsfs_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package op_e2e
import (
"errors"
"testing"
"github.com/stretchr/testify/require"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-chain-ops/foundry"
"github.com/ethereum-optimism/optimism/op-service/testlog"
)
func TestArtifacts(t *testing.T) {
logger := testlog.Logger(t, log.LevelWarn) // lower this log level to get verbose test dump of all artifacts
af := foundry.OpenArtifactsDir("../packages/contracts-bedrock/forge-artifacts")
artifacts, err := af.ListArtifacts()
require.NoError(t, err)
require.NotEmpty(t, artifacts)
for _, name := range artifacts {
contracts, err := af.ListContracts(name)
require.NoError(t, err, "failed to list %s", name)
require.NotEmpty(t, contracts)
for _, contract := range contracts {
artifact, err := af.ReadArtifact(name, contract)
if err != nil {
if errors.Is(err, foundry.ErrLinkingUnsupported) {
logger.Info("linking not supported", "name", name, "contract", contract, "err", err)
continue
}
require.NoError(t, err, "failed to read artifact %s / %s", name, contract)
}
logger.Info("artifact",
"name", name,
"contract", contract,
"compiler", artifact.Metadata.Compiler.Version,
"sources", len(artifact.Metadata.Sources),
"evmVersion", artifact.Metadata.Settings.EVMVersion,
)
}
}
}