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

daserver: Option discard-after-timeout for DAS S3 storage archiving mode is setting the wrong AWS S3 option. #3004

Open
imelon2 opened this issue Mar 10, 2025 · 0 comments

Comments

@imelon2
Copy link

imelon2 commented Mar 10, 2025

Describe the bug
The arbitrum documentation's [Archive DA servers] specifies that the option discard-after-timeout must be set to false for DAS S3 archiving, as shown below.

To activate the "archive mode" in your DAS, set the parameter discard-after-timeout to false in your storage method. For example:
--data-availability.s3-storage.discard-after-timeout=false

I set that option to true for pruning S3 Storage after each expiration period of Batch Data, but it didn't work as expected.

Expected behavior
The code snippet demonstrates how the discard-after-timeout option for S3 storage is implemented. Specifically, when s3s.discardAfterTimeout is enabled and the provided timeout value is valid, the code computes an expiration time from the timeout and sets it in the S3.putObjectInput.Expires field. This configuration instructs S3 to automatically expire the stored object after the specified time.

func (s3s *S3StorageService) Put(ctx context.Context, value []byte, timeout uint64) error {
	logPut("das.S3StorageService.Store", value, timeout, s3s)
	putObjectInput := s3.PutObjectInput{
		Bucket: aws.String(s3s.bucket),
		Key:    aws.String(s3s.objectPrefix + EncodeStorageServiceKey(dastree.Hash(value))),
		Body:   bytes.NewReader(value)}
	if s3s.discardAfterTimeout && timeout <= math.MaxInt64 {
		// #nosec G115
		expires := time.Unix(int64(timeout), 0)
		putObjectInput.Expires = &expires
	}
	_, err := s3s.client.Upload(ctx, &putObjectInput)
	if err != nil {
		log.Error("das.S3StorageService.Store", "err", err)
	}
	return err
}

Permalink

The dasever options discard-after-timeout determines whether or not the HTTP-Expire timeout is set when making data storage API requests to S3. This option has nothing to do with DAS archive mode and appears to be wrong code.

it looks like should set Expiration rather than Expires

	// The date and time at which the object is no longer cacheable. For more
	// information, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21
	// (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21).
	Expires *time.Time
@imelon2 imelon2 changed the title DAS: Option discard-after-timeout for DAS S3 storage archiving mode is setting the wrong AWS S3 option. daserver: Option discard-after-timeout for DAS S3 storage archiving mode is setting the wrong AWS S3 option. Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant