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

Automate complete setup of a node with domains, registry & transports #295

Merged
merged 62 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
48b591d
Adding status
dwertent Oct 4, 2024
a3536b4
Implement correct error handling for idempotencyKeys
peterbroadhurst Oct 11, 2024
eccf650
Refactor of SmartContractDeployment in operator
peterbroadhurst Oct 11, 2024
e5dfff2
Reconcile naming
peterbroadhurst Oct 11, 2024
6071320
Fix up public tx mgr tests around gas price inconsistency
peterbroadhurst Oct 11, 2024
e59942b
Generate contract samples from solidity
peterbroadhurst Oct 11, 2024
21f7a34
Reconcile startup order for component requirements
peterbroadhurst Oct 11, 2024
62e3470
Fix startup issue
peterbroadhurst Oct 11, 2024
3385eb1
Correct contractAddress mapping
peterbroadhurst Oct 11, 2024
4699410
spelling
peterbroadhurst Oct 11, 2024
f01d5a8
Add PaladinRegistry CR
peterbroadhurst Oct 11, 2024
ccbf324
Adding exit process print
dwertent Oct 11, 2024
7e79bbb
Add reconcile for EVM registry
peterbroadhurst Oct 11, 2024
1c54545
verifyResourceReady
dwertent Oct 11, 2024
7b8701e
Merge branch 'three-body-problem' into status
dwertent Oct 11, 2024
5a7a918
PaladinDomain CR worked through with coupling to SCD
peterbroadhurst Oct 11, 2024
c027877
Merge branch 'three-body-problem' into status
dwertent Oct 11, 2024
f820d7c
Merge pull request #273 from kaleido-io/status
dwertent Oct 11, 2024
4b5153e
e2e depends on deploy
dwertent Oct 11, 2024
cb61dac
Start on label selectors
peterbroadhurst Oct 11, 2024
6700127
Merge with upstream
peterbroadhurst Oct 11, 2024
8a0d642
Add query interface for indexed transactions
peterbroadhurst Oct 11, 2024
667e9b0
Fight with generics until we can list things without code duplication
peterbroadhurst Oct 11, 2024
dc112a2
Work on Domain lib/jar loading
peterbroadhurst Oct 11, 2024
976abcb
Fix block indexer start order problem with event streams
peterbroadhurst Oct 12, 2024
9025865
Do not kick off the init until after constructor has completed
peterbroadhurst Oct 12, 2024
2618514
Bundle all the deps for pente
peterbroadhurst Oct 12, 2024
b1e570b
Bundle all solidity output into pente.jar
peterbroadhurst Oct 12, 2024
2ae7e40
Declare dep on :solidity:compile for Jar
peterbroadhurst Oct 12, 2024
e71a196
Merge branch 'main' of https://github.com/kaleido-io/paladin into thr…
peterbroadhurst Oct 12, 2024
302c0e5
Add label reconcile for registries
peterbroadhurst Oct 12, 2024
2ff7ccb
Build work for registries and transports
peterbroadhurst Oct 12, 2024
0083cef
Fix TestDomain init()
peterbroadhurst Oct 13, 2024
57c7c01
Tweaks to dockerbuild for faster iterations
peterbroadhurst Oct 13, 2024
701a389
Registry starting ready for registration
peterbroadhurst Oct 13, 2024
6e5e131
Add certmanager config
peterbroadhurst Oct 13, 2024
c87ef7a
TLS certificate issuances and transports
peterbroadhurst Oct 13, 2024
ef902d8
Block indexer RPC
gabriel-indik Oct 11, 2024
bb1b4d1
Work through RPC calls fro block indexer
peterbroadhurst Oct 13, 2024
e477ac8
Add RPC for querying local transport details
peterbroadhurst Oct 13, 2024
438e008
Add local transport details extraction to GRPC transport
peterbroadhurst Oct 13, 2024
6c8e518
Expose block indexer RPC and pre-calc externalHostname
peterbroadhurst Oct 13, 2024
6bf43c0
PaladinRegistration implementation foundation
peterbroadhurst Oct 13, 2024
a32a674
Expose JSON/RPC functions from registryMgr
peterbroadhurst Oct 13, 2024
4c76731
Work through to testing registration e2e
peterbroadhurst Oct 13, 2024
22a5a2d
Fix LIMIT on queries
peterbroadhurst Oct 13, 2024
8961fb8
Fix public transaction submission
peterbroadhurst Oct 14, 2024
4339f77
Tweaks to display info
peterbroadhurst Oct 14, 2024
2dd2c47
Various build tweaks
peterbroadhurst Oct 14, 2024
85d674c
UndefinedVar: Usage of undefined variable '' (line 148)
peterbroadhurst Oct 14, 2024
3a66fc8
Reinstate use of gradle with our own download, as gradlew seems broke…
peterbroadhurst Oct 14, 2024
148d89d
Add missing dependency
peterbroadhurst Oct 14, 2024
c7c439e
Update apply of node
peterbroadhurst Oct 14, 2024
46b97e1
Need to generate the samples first
peterbroadhurst Oct 14, 2024
3cfb6a4
Disable push build for operator for now until stable
peterbroadhurst Oct 14, 2024
5cc481d
Up test timeout to 60s for now - until more time to tune tests
peterbroadhurst Oct 14, 2024
3bcbc83
delete with namespace name
dwertent Oct 14, 2024
1ec120e
wip: update rbac role
dwertent Oct 14, 2024
4566292
wip: Remove kubebuilder from controllers
dwertent Oct 14, 2024
9b940b6
wip: fix linter issues
dwertent Oct 14, 2024
8a1801a
wip: use dependencies charts
dwertent Oct 14, 2024
6ed350b
Testing e2e
dwertent Oct 14, 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
55 changes: 55 additions & 0 deletions .github/workflows/operator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Paladin Operator Build

on:
push:
branches:
- main
paths:
- 'operator/**'
pull_request:
paths:
- 'operator/**'
workflow_dispatch:


jobs:
operator-build:
runs-on: ubuntu-latest
env:
CLUSTER_NAME: paladin
NAMESPACE: paladin

steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
check-latest: true

# - name: Go Lint
# working-directory: operator
# run: make lint

# - name: Unit Tests
# working-directory: operator
# run: make test

- name: Create Kubernetes Kind Cluster
uses: helm/kind-action@v1
with:
install_only: true # only install kind, the cluster creation is managed by the deploy step
ignore_failed_clean: true

- name: E2E Operator
working-directory: operator
run: gradle e2e -PclusterName=${{ env.CLUSTER_NAME }} -Pnamespace=${{ env.NAMESPACE }}

- name: Uninstall Operator
working-directory: operator
run: gradle clean -PclusterName=${{ env.CLUSTER_NAME }} -Pnamespace=${{ env.NAMESPACE }} -PdeleteCluster=true
6 changes: 4 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"go.formatFlags": ["-s"],
"go.lintTool": "golangci-lint",
"cSpell.words": [],
"cSpell.words": [
"idempotency"
],
"go.testTimeout": "60s",
"java.configuration.updateBuildConfiguration": "disabled",
"go.testTags": "testdbpostgres"
// "go.testTags": "testdbpostgres"
}

56 changes: 45 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ ARG NODE_VERSION=20.17.0
ARG PROTO_VERSION=28.2
ARG GO_VERSION=1.22.7
ARG GO_MIGRATE_VERSION=4.18.1
ARG GRADLE_VERSION=8.4
ARG GRADLE_VERSION=8.5
ARG WASMER_VERSION=4.3.7

# Additional JVM selection options
ARG JVM_TYPE=hotspot
ARG JVM_HEAP=normal

# Stage 1: Builder
FROM ubuntu:24.04 AS builder
# Stage 1: Builder base for all the sub-builds
FROM ubuntu:24.04 AS base-builder

ARG TARGETOS
ARG TARGETARCH
Expand Down Expand Up @@ -91,17 +91,51 @@ ENV PATH=$PATH:/usr/local/wasmer/bin
# Set the working directory
WORKDIR /app

# Copy project files (check .dockerignore for details of what goes up)
COPY . .
# Initialize gradle and build tasks
COPY build.gradle settings.gradle ./
COPY buildSrc buildSrc
RUN gradle --no-daemon --parallel :buildSrc:jar

# Copy in a set of thing before the first gradle command that are less likely to change
COPY solidity solidity
COPY config config
COPY toolkit/proto toolkit/proto
COPY toolkit toolkit
COPY go.work.sum ./

# We have to use a special minimal go.work for this
COPY go.work.base go.work

# Set Go CGO environment variables
ENV CGO_ENABLED=1
ENV CC=gcc

# Assemble executables/artifacts
# This minimal set of commands primes the build with some slower things that accellerate rebuilds:
# - Installing gradle with the wrapper
# - Compiling the groovy buildSrc
# - Installing a bunch of base Go pre-reqs
RUN gradle --no-daemon --parallel :toolkit:go:assemble :solidity:compile

# Stage 2... Full build - currently core/zeto/noto/core are all cop-req'd together
# (If we untangle this we can get more parallelism and less re-build in our docker build)
FROM base-builder AS full-builder
COPY go.work go.work
COPY core/go core/go
COPY core/java core/java
COPY toolkit/java toolkit/java
COPY domains/pente domains/pente
COPY domains/zeto domains/zeto
COPY domains/noto domains/noto
COPY domains/integration-test domains/integration-test
COPY registries/static registries/static
COPY registries/evm registries/evm
COPY transports/grpc transports/grpc
# No build of these two, but we need to go.mod to make the go.work valid
COPY testinfra/go.mod testinfra/go.mod
COPY operator/go.mod operator/go.mod
RUN gradle --no-daemon --parallel assemble

# Stage 2: Runtime
# Stage 3: Pull together runtime
FROM ubuntu:24.04 AS runtime

ARG TARGETOS
Expand All @@ -119,7 +153,7 @@ RUN apt-get update && apt-get install -y \

# Set environment variables
ENV LANG=C.UTF-8
ENV LD_LIBRARY_PATH=/app/libs:/usr/local/wasmer/lib:$LD_LIBRARY_PATH
ENV LD_LIBRARY_PATH=/app/libs:/usr/local/wasmer/lib

# Set the working directory
WORKDIR /app
Expand All @@ -136,13 +170,13 @@ RUN GO_MIRGATE_ARCH=$( if [ "$TARGETARCH" = "arm64" ]; then echo -n "arm64"; els
tar -C /usr/local/bin -xzf - migrate

# Copy Wasmer shared libraries to the runtime container
COPY --from=builder /usr/local/wasmer/lib/libwasmer.so /usr/local/wasmer/lib/libwasmer.so
COPY --from=full-builder /usr/local/wasmer/lib/libwasmer.so /usr/local/wasmer/lib/libwasmer.so

# Copy the build artifacts from the builder stage
COPY --from=builder /app/build /app
COPY --from=full-builder /app/build /app

# Copy the db migration files
COPY --from=builder /app/core/go/db /app/db
COPY --from=full-builder /app/core/go/db /app/db

# Add tools we installed to the path
ENV PATH=$PATH:/usr/local/java/bin
Expand Down
54 changes: 52 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,25 @@ def domains = [
'domains/zeto/build/libs'
]

def registries = [
'registries/static/build/libs',
'registries/evm/build/libs',
]

def transports = [
'transports/grpc/build/libs',
]

def assembleSubprojects = [
':core:go',
':core:java',
':toolkit:go',
':domains:pente',
':domains:noto',
':domains:zeto'
':domains:zeto',
':registries:static',
':registries:evm',
':transports:grpc',
]

ext {
Expand Down Expand Up @@ -111,14 +123,52 @@ task copyDomains(type: Copy) {
}
}

task copyRegistries(type: Copy) {
def registriesDir = file("${buildDir}/registries")

doFirst {
registriesDir.mkdirs()
}

registries.each { dir ->
from dir
}
into registriesDir

outputs.upToDateWhen { false }

doLast {
println "Copied registries to ${registriesDir}"
}
}

task copyTransports(type: Copy) {
def transportsDir = file("${buildDir}/transports")

doFirst {
transportsDir.mkdirs()
}

transports.each { dir ->
from dir
}
into transportsDir

outputs.upToDateWhen { false }

doLast {
println "Copied transports to ${transportsDir}"
}
}

// Root assemble task that depends on subproject's assemble tasks
task assemble {
assembleSubprojects.each { projectPath ->
dependsOn "${projectPath}:assemble"
}
}

assemble.finalizedBy(copyLibraries, copyDomains)
assemble.finalizedBy(copyLibraries, copyDomains, copyRegistries, copyTransports)

defaultTasks 'build'

Expand Down
14 changes: 10 additions & 4 deletions config/pkg/pldconf/publictxmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,16 @@ type AutoFuelingConfig struct {
}

type GasPriceConfig struct {
IncreaseMax *string `json:"increaseMax"`
IncreasePercentage *int `json:"increasePercentage"`
FixedGasPrice any `json:"fixedGasPrice"` // number or object
Cache CacheConfig `json:"cache"`
IncreaseMax *string `json:"increaseMax"`
IncreasePercentage *int `json:"increasePercentage"`
FixedGasPrice any `json:"fixedGasPrice"` // number or object
GasOracleAPI GasOracleAPIConfig `json:"gasOracleAPI"`
Cache CacheConfig `json:"cache"`
}

type GasOracleAPIConfig struct {
URL string `json:"url"`
Template string `json:"template"`
}

type PublicTxManagerOrchestratorConfig struct {
Expand Down
6 changes: 3 additions & 3 deletions config/pkg/pldconf/registrymgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import (
)

type RegistryManagerConfig struct {
Registries map[string]*RegistryConfig `yaml:"registries"`
RegistryManager RegistryManagerManagerConfig `yaml:"registryManager"`
Registries map[string]*RegistryConfig `json:"registries"`
RegistryManager RegistryManagerManagerConfig `json:"registryManager"`
}

type RegistryManagerManagerConfig struct {
RegistryCache CacheConfig `yaml:"registryCache"`
RegistryCache CacheConfig `json:"registryCache"`
}

var RegistryCacheDefaults = &CacheConfig{
Expand Down
2 changes: 1 addition & 1 deletion config/pkg/pldconf/tlsconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ type TLSConfig struct {
Cert string `json:"cert,omitempty"`
KeyFile string `json:"keyFile,omitempty"`
Key string `json:"key,omitempty"`
InsecureSkipHostVerify bool `json:"insecureSkipHostVerify"`
InsecureSkipHostVerify bool `json:"insecureSkipHostVerify,omitempty"`
RequiredDNAttributes map[string]string `json:"requiredDNAttributes,omitempty"`
}
2 changes: 1 addition & 1 deletion core/go/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ abstract class UnitTests extends Exec {
args './pkg/...', './internal/...'
args '-cover'
args '-covermode=atomic'
args '-timeout=30s'
args '-timeout=60s'
if (project.findProperty('verboseTests') == 'true') {
args '-v'
}
Expand Down
5 changes: 4 additions & 1 deletion core/go/componenttest/component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ db:
autoMigrate: true
migrationsDir: ../db/migrations/sqlite
debugQueries: false
blockIndexer:
fromBlock: latest
blockchain:
http:
url: http://localhost:8545
Expand Down Expand Up @@ -182,6 +184,7 @@ func TestPrivateTransactionsDeployAndExecute(t *testing.T) {
require.NoError(t, err)
assert.Len(t, txns, 0)
var dplyTxID uuid.UUID

err = rpcClient.CallRPC(ctx, &dplyTxID, "ptx_sendTransaction", &ptxapi.TransactionInput{
ABI: *domains.SimpleTokenConstructorABI(),
Transaction: ptxapi.Transaction{
Expand Down Expand Up @@ -245,7 +248,7 @@ func TestPrivateTransactionsDeployAndExecute(t *testing.T) {
"Transaction did not receive a receipt",
)

err = rpcClient.CallRPC(ctx, &txns, "ptx_queryTransactions", query.NewQueryBuilder().Limit(1).Query(), true)
err = rpcClient.CallRPC(ctx, &txns, "ptx_queryTransactions", query.NewQueryBuilder().Limit(2).Query(), true)
require.NoError(t, err)
assert.Len(t, txns, 2)

Expand Down
13 changes: 9 additions & 4 deletions core/go/componenttest/utils_for_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"crypto/x509"
"crypto/x509/pkix"
_ "embed"
"encoding/json"
"encoding/pem"
"fmt"
"math/big"
Expand Down Expand Up @@ -122,7 +123,9 @@ func deplyDomainRegistry(t *testing.T) *tktypes.EthAddress {
cmTmp := componentmgr.NewComponentManager(context.Background(), grpcTarget, uuid.New(), &tmpConf)
err = cmTmp.Init()
require.NoError(t, err)
err = cmTmp.StartComponents()
err = cmTmp.StartManagers()
require.NoError(t, err)
err = cmTmp.CompleteStart()
require.NoError(t, err)
domainRegistryAddress := domains.DeploySmartContract(t, cmTmp.BlockIndexer(), cmTmp.EthClientFactory())

Expand Down Expand Up @@ -181,6 +184,7 @@ func newInstanceForComponentTesting(t *testing.T, domainRegistryAddress *tktypes
i.ctx = log.WithLogField(i.ctx, "node-name", binding.name)

i.conf.Log.Level = confutil.P("info")
i.conf.BlockIndexer.FromBlock = json.RawMessage(`"latest"`)
i.conf.DomainManagerConfig.Domains = make(map[string]*pldconf.DomainConfig, 1)
i.conf.DomainManagerConfig.Domains["domain1"] = &pldconf.DomainConfig{
Plugin: pldconf.PluginConfig{
Expand Down Expand Up @@ -249,9 +253,6 @@ func newInstanceForComponentTesting(t *testing.T, domainRegistryAddress *tktypes
err = cm.Init()
require.NoError(t, err)

err = cm.StartComponents()
require.NoError(t, err)

err = cm.StartManagers()
require.NoError(t, err)

Expand Down Expand Up @@ -300,8 +301,12 @@ func testConfig(t *testing.T) pldconf.PaladinConfig {

port, err := getFreePort()
require.NoError(t, err, "Error finding a free port")
conf.GRPC.ShutdownTimeout = confutil.P("0s")
conf.RPCServer.HTTP.ShutdownTimeout = confutil.P("0s")
conf.RPCServer.HTTP.Port = &port
conf.RPCServer.HTTP.Address = confutil.P("127.0.0.1")
conf.RPCServer.WS.ShutdownTimeout = confutil.P("0s")
conf.RPCServer.WS.Disabled = true
conf.Log.Level = confutil.P("info")

conf.Signer.KeyStore.Static.Keys["seed"] = pldconf.StaticKeyEntryConfig{
Expand Down
2 changes: 1 addition & 1 deletion core/go/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func Run(grpcTargetPtr, loaderUUIDPtr, configFilePtr, modePtr *C.char) (rc int)
panicked := recover()
if panicked != nil {
// print the stack
fmt.Fprintf(os.Stderr, "%s\n", debug.Stack())
fmt.Fprintf(os.Stderr, "%s %s\n", panicked, debug.Stack())
// set the rc
rc = 1
}
Expand Down
Loading
Loading